/**
 * 
 */
package fr.cephb.socialsnp.webapp.form;

import fr.cephb.util.MessageType;

/**
 * @author lindenb
 *
 */
public class MinOccurenceValidator
	extends AbstractValidator<Integer>
	{
	public MinOccurenceValidator(int minOcc)
		{
		super(minOcc);
		}
	
	/* (non-Javadoc)
	 * @see fr.cephb.socialsnp.webapp.form.Validator#validate(fr.cephb.socialsnp.webapp.form.FormParam)
	 */
	@Override
	public void validate(FormParam param)
		{
		if( param.getValues().size()< getValue() )
			{
			param.getErrors().add(new ErrorMessage(
					MessageType.ERROR,
					param.getLabel()+" expected at least "+getValue()+" values."
					));

			}
		}

}
